import { axiosInstance } from 'src/boot/axios'
import CommonConfig from 'src/assets/js/config'

// const minioUrl = CommonConfig.fileUrl + '/v1/minio'
const baseUrl = CommonConfig.fileUrl + '/v1'

/**
 * 标记/取消标记:
 * @param id
 * @param transferableFlag
 * @returns {Promise<*>}
 */
export function putSignById (versionFileId, transferableFlag) {
  const newUrl = baseUrl + `/version_file/${versionFileId}:mark?transferableFlag=${transferableFlag}`
  return axiosInstance.put(newUrl).then((res) => {
    return Promise.resolve(res)
  })
}
export function postSignById (filePath, transferableFlag) {
  const newUrl = baseUrl + `/version_file:mark`
  const params = {
    filePath,
    transferableFlag
  }
  return axiosInstance.post(newUrl, params).then((res) => {
    return Promise.resolve(res)
  })
}

/**
 * 获取配置人员信息
 * @returns {Promise<*>}
 */
export function getMarkSetting () {
  const newUrl = baseUrl + `/marking_settings`
  return axiosInstance.get(newUrl).then((res) => {
    return Promise.resolve(res)
  })
}

/**
 * 更新配置人员
 * @returns {Promise<*>}
 */
export function putMarkSetting (params) {
  const newUrl = baseUrl + `/marking_settings`
  return axiosInstance.put(newUrl, params).then((res) => {
    return Promise.resolve(res)
  })
}
